package com.wc.AlgoOJ.LQ1313_求阶乘;

import java.util.Scanner;

/**
 * @Author congge
 * @Date 2024/3/27 21:07
 * @description http://43.138.190.70:8888/p/LQ1313
 */
public class Main {
    static long k;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        k = sc.nextLong();
        // 0 取决于 2 与5的个数，但是2的个数远远小于5 的个数，那就直接遍历有多少个5的质因子，是可以用二分的,有点思维
        long l = 1, r = Long.MAX_VALUE / 2;
        while (l < r) {
            long mid = l + r >> 1;
            if (check(mid) >= k) r = mid;
            else l = mid + 1;
        }
        if (check(l) == k) System.out.println(l);
        else System.out.println(-1);
    }

    static long check(long mid) {
        long cnt = 0;
        while (mid > 0) {
            cnt += mid / 5;
            mid /= 5;
        }
        return cnt;
    }
}

